class Solution
{
public:
    vector<int> getMaximumXor(vector<int> &nums, int maximumBit)
    {
        int maxVal = (1 << maximumBit) - 1;
        int xorResult = 0;
        for (int num : nums)
        {
            xorResult ^= num;
        }
        vector<int> result;
        for (int i = nums.size() - 1; i >= 0; --i)
        {
            result.push_back(xorResult ^ maxVal);
            xorResult ^= nums[i];
        }
        return result;
    }
};